import { request as http } from '../service'
import IBaseObj from '#/index'

const getUserByPage = (data: IBaseObj) =>
  http({
    url: '/user/query',
    method: 'post',
    data,
  })

const saveUser = (data: IBaseObj) =>
  http({
    url: '/user/create',
    method: 'post',
    data,
  })

const updateUser = (data: IBaseObj) =>
  http({
    url: '/user/modify',
    method: 'post',
    data,
  })

const getUserById = (uid: string | number) =>
  http({
    url: `/user/${uid}`,
    method: 'get',
  })

const delUrl = '/user'

// new
const getUserList = (data: IBaseObj) =>
  http({
    url: '/user/list',
    method: 'post',
    data,
  })

const getMemberList = (pid: string | number) =>
  http({
    url: `/user/list/member`,
    method: 'get',
    params: {
      pid,
    },
  })

export default {
  getUserByPage,
  getUserById,
  saveUser,
  delUrl,

  getUserList,
  updateUser,
  getMemberList,
}
